<template>
	<div class="model">
		<h2 class="model__title">退款详情<span @click="close" class="model__title--close">&times;</span></h2>
		<div class="model__content" v-loading="loading">
			<div v-if="data">

				<div class="item" v-if="data.reject_reason">
					<h2 class="item__title" style="color: #f20;">驳回理由</h2>
					<div class="item__reason">
						{{data.reject_reason}}
					</div>
				</div>
				<div class="item">
					<h2 class="item__title">订单基本信息</h2>
					<div class="item__detail">
						<span class="item__detail--title">订单流水号:</span>
						<span class="item__detail--value">{{data.order.flow_no}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">订单金额:</span>
						<span class="item__detail--value">{{data.order.order_money}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">是否需要开票:</span>
						<span class="item__detail--value">
							<el-tag type="success" v-if="data.order.need_invoice" size="small">需要开票</el-tag>
							<el-tag type="warning" v-else size="small">不需要开票</el-tag>
						</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">支付流水号:</span>
						<span class="item__detail--value">{{data.order.pay_flow_no}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">下单时间:</span>
						<span v-if="data.order.create_time" class="item__detail--value">{{data.order.create_time | formatTime}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">完成时间:</span>
						<span v-if="data.order.finish_time" class="item__detail--value">{{data.order.finish_time | formatTime}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">支付金额:</span>
						<span class="item__detail--value">{{data.order.pay_money}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">开票状态:</span>
						<span class="item__detail--value">
							<el-tag v-if="data.order.has_taken_invoice" size="small">已开票</el-tag>
							<el-tag v-else type="warning" size="small">未开票</el-tag>							
						</span>
					</div>
				</div>
				<div class="item">
					<h2 class="item__title">价格基本信息</h2>
					<div class="item__detail">
						<span class="item__detail--title">订单价格:</span>
						<span class="item__detail--value">{{data.order.order_money}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">支付金额:</span>
						<span class="item__detail--value">{{data.order.pay_money}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">点元:</span>
						<span class="item__detail--value">{{data.order.dian_yuan}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">点币:</span>
						<span class="item__detail--value">{{data.order.dian_bi}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">点分:</span>
						<span class="item__detail--value">{{data.order.dian_fen}}</span>
					</div>
				</div>
				<div class="item">
					<h2 class="item__title">货物详情</h2>
					<div v-for="item in data.order.commodities" class="goods-detail">
						<div class="item__detail item__detail-block">
							<span class="item__detail--title">商品名:&nbsp;</span>
							<img :src="item.mainimg.url" class="item__detail--pic" />
							<span class="item__detail--value">{{item.commodity_name}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">商品库存:&nbsp;</span>
							<span class="item__detail--value">{{item.stocks}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">是否为点分商品:&nbsp;</span>
							<span class="item__detail--value">
								<span v-if="item.is_fen">是</span>
							<span v-else>否</span>
							</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">是否邮寄:&nbsp;</span>
							<span class="item__detail--value">
								<span v-if="item.is_post">是</span>
							<span v-else>否</span>
							</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">是否线上销售:&nbsp;</span>
							<span class="item__detail--value">
								<span v-if="item.is_online">是</span>
							<span v-else>否</span>
							</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">好评率:&nbsp;</span>
							<span class="item__detail--value">{{item.good_comment_rate}}%</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">卖价:&nbsp;</span>
							<span class="item__detail--value">{{item.sale_price}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">上架时间:&nbsp;</span>
							<span class="item__detail--value">{{item.onshief_time | formatTime}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">商品评分:&nbsp;</span>
							<span class="item__detail--value">{{item.comment_score}}分</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">评论数:&nbsp;</span>
							<span class="item__detail--value"></span> {{item.comment_num}}
						</div>
						<div class="item__detail">
							<span class="item__detail--title">收藏数:&nbsp;</span>
							<span class="item__detail--value">{{item.collection_num}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">浏览次数:&nbsp;</span>
							<span class="item__detail--value">{{item.see_num}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">分享次数:&nbsp;</span>
							<span class="item__detail--value">{{item.share_num}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">销售次数:&nbsp;</span>
							<span class="item__detail--value">{{item.sale_num}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">商品编号:&nbsp;</span>
							<span class="item__detail--value">{{item.commodity_no}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">商品总销量:&nbsp;</span>
							<span class="item__detail--value">{{item.total_sale_num}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">点币:&nbsp;</span>
							<span class="item__detail--value">{{item.dian_bi}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">点币价格:&nbsp;</span>
							<span class="item__detail--value">{{item.bi_price}}</span>
						</div>
					</div>
				</div>
				<div class="item">
					<h2 class="item__title">退款用户</h2>
					<div class="item__detail">
						<span class="item__detail--title">用户昵称:&nbsp;&nbsp;</span>
						<img :src="data.order.member.head_img" class="item__detail--pic " />
						<span class="item__detail--value">{{data.order.member.nick_name}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">用户身份:&nbsp;&nbsp;</span>
						<span class="item__detail--value">
							<el-tag v-if="data.order.member.is_saleman">推广大使</el-tag>
							<el-tag v-if="data.order.member.is_manager">区域经理</el-tag>
							<el-tag v-if="data.order.member.is_company_manager">推广商家</el-tag>
							<el-tag 
								type="info"
								v-if="!data.order.member.is_saleman&&!data.order.member.is_manager&&!data.order.member.is_company_manager"
								>普通用户
							</el-tag>							
						</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">真实姓名:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.order.member.real_name}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">用户手机号码:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.order.member.mobile}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">连续签到天数:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.order.member.continue_signin_days}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">用户注册时间:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.order.member.regist_time}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">用户邮箱:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.order.member.email}}</span></div>
					<div class="item__detail">
						<span class="item__detail--title">用户成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.order.member.grow_value}}</span></div>
					<div class="item__detail">
						<span class="item__detail--title">线上现金成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.order.member.on_cash_grow}}</span>
					</div>
					<div class="item__detail"><span class="item__detail--title">线下现金成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.order.member.off_cash_grow}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">线上点元成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.order.member.on_yuan_grow}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">线下点元成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.order.member.off_yuan_grow}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">线上点分成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.order.member.on_fen_grow}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">消费频率成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.order.member.rf_grow}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">消费激励成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.order.member.cost_grow}}</span>
					</div>
					<div class="item__detail">
						<span class="item__detail--title">活跃成长值:&nbsp;&nbsp;</span>
						<span class="item__detail--value">{{data.order.member.login_grow}}</span>
					</div>
				</div>
			</div>

		</div>
	</div>
</template>

<script>
	export default {
		created() {
			this.fetchReturnMoney();
		},
		props: ["id"],
		data() {
			return {
				loading: true,
				data: null
			}
		},
		methods: {
			close() {
				this.$parent.showModel = false;
			},
			fetchReturnMoney() {
				this.loading = true;
				var url = `${this.url}/order/returnmoney_get_detail.action`;
				var params = {
					return_money_id: this.id
				};
				this.$http.get(url, {
					params
				}).then((res) => {
					this.loading = false;
					console.log(res.data)
					this.data = res.data.result;
				});
			}
		},
		computed: {

		}
	}
</script>

<style lang="scss" scoped>

</style>